using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpaceTimePatternMiningTools._Utilities
{
    /// <summary>
    /// <para>Fill Missing Values</para>
    /// <para>Replaces missing (null) values with estimated values based on spatial neighbors, space-time neighbors, or time-series values.</para>
    /// <para>将缺失 （null） 值替换为基于空间相邻项、时空相邻项或时序值的估计值。</para>
    /// </summary>    
    [DisplayName("Fill Missing Values")]
    public class FillMissingValues : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public FillMissingValues()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_features">
        /// <para>Input Features</para>
        /// <para>The feature class containing the null values to be filled.</para>
        /// <para>包含要填充的 null 值的要素类。</para>
        /// </param>
        /// <param name="_fields_to_fill">
        /// <para>Fields to Fill</para>
        /// <para>The numeric fields containing missing data (null values).</para>
        /// <para>包含缺失数据（空值）的数值字段。</para>
        /// </param>
        /// <param name="_fill_method">
        /// <para>Fill Method</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of calculation that will be applied. The Temporal Trend option is only available if the Location ID and Time Field parameter values are specified.</para>
        ///   <bulletList>
        ///     <bullet_item>Average—Null values will be replaced with the mean (average) value of the feature's neighbors.</bullet_item><para/>
        ///     <bullet_item>Minimum—Null values will be replaced with the minimum (smallest) value of the feature's neighbors.</bullet_item><para/>
        ///     <bullet_item>Maximum—Null values will be replaced with the maximum (largest) value of the feature's neighbors.</bullet_item><para/>
        ///     <bullet_item>Median—Null values will be replaced with the median (sorted middle value) of the feature's neighbors.</bullet_item><para/>
        ///     <bullet_item>Temporal Trend—Null values will be replaced based on the trend at that unique location.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将应用的计算类型。仅当指定了“位置 ID”和“时间字段”参数值时，“时态趋势”选项才可用。</para>
        ///   <bulletList>
        ///     <bullet_item>平均值—空值将替换为要素相邻要素的平均值（平均值）。</bullet_item><para/>
        ///     <bullet_item>最小值 - 空值将替换为要素相邻节点的最小（最小）值。</bullet_item><para/>
        ///     <bullet_item>最大值 - 空值将替换为要素相邻要素的最大（最大）值。</bullet_item><para/>
        ///     <bullet_item>中位数—空值将替换为要素相邻点的中位数（排序的中间值）。</bullet_item><para/>
        ///     <bullet_item>时态趋势—将根据该唯一位置的趋势替换空值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public FillMissingValues(object _in_features, List<object> _fields_to_fill, _fill_method_value? _fill_method)
        {
            this._in_features = _in_features;
            this._fields_to_fill = _fields_to_fill;
            this._fill_method = _fill_method;
        }
        public override string ToolboxName => "Space Time Pattern Mining Tools";

        public override string ToolName => "Fill Missing Values";

        public override string CallName => "stpm.FillMissingValues";

        public override List<string> AcceptEnvironments => ["geographicTransformations", "outputCoordinateSystem"];

        public override object[] ParameterInfo => [_in_features, _out_features, _fields_to_fill, _fill_method.GetGPValue(), _conceptualization_of_spatial_relationships.GetGPValue(), _distance_band, _temporal_neighborhood, _time_field, _number_of_spatial_neighbors, _location_id, _related_table, _related_location_id, _weights_matrix_file, _unique_id, _null_value, _out_table, _append_to_input.GetGPValue(), _updated_features];

        /// <summary>
        /// <para>Input Features</para>
        /// <para>The feature class containing the null values to be filled.</para>
        /// <para>包含要填充的 null 值的要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Output Features</para>
        /// <para><xdoc>
        ///   <para>The output that will include the filled (estimated) values.</para>
        ///   <para>If the Related Table parameter value is specified, Output Features will contain the number of estimated values at each location, and Output Table will contain the filled (estimated) values.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将包含填充（估计）值的输出。</para>
        ///   <para>如果指定了相关表参数值，则输出要素将包含每个位置的估计值数，输出表将包含填充（估计）值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_features { get; set; } = null;


        /// <summary>
        /// <para>Fields to Fill</para>
        /// <para>The numeric fields containing missing data (null values).</para>
        /// <para>包含缺失数据（空值）的数值字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Fields to Fill")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _fields_to_fill { get; set; }


        /// <summary>
        /// <para>Fill Method</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of calculation that will be applied. The Temporal Trend option is only available if the Location ID and Time Field parameter values are specified.</para>
        ///   <bulletList>
        ///     <bullet_item>Average—Null values will be replaced with the mean (average) value of the feature's neighbors.</bullet_item><para/>
        ///     <bullet_item>Minimum—Null values will be replaced with the minimum (smallest) value of the feature's neighbors.</bullet_item><para/>
        ///     <bullet_item>Maximum—Null values will be replaced with the maximum (largest) value of the feature's neighbors.</bullet_item><para/>
        ///     <bullet_item>Median—Null values will be replaced with the median (sorted middle value) of the feature's neighbors.</bullet_item><para/>
        ///     <bullet_item>Temporal Trend—Null values will be replaced based on the trend at that unique location.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将应用的计算类型。仅当指定了“位置 ID”和“时间字段”参数值时，“时态趋势”选项才可用。</para>
        ///   <bulletList>
        ///     <bullet_item>平均值—空值将替换为要素相邻要素的平均值（平均值）。</bullet_item><para/>
        ///     <bullet_item>最小值 - 空值将替换为要素相邻节点的最小（最小）值。</bullet_item><para/>
        ///     <bullet_item>最大值 - 空值将替换为要素相邻要素的最大（最大）值。</bullet_item><para/>
        ///     <bullet_item>中位数—空值将替换为要素相邻点的中位数（排序的中间值）。</bullet_item><para/>
        ///     <bullet_item>时态趋势—将根据该唯一位置的趋势替换空值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Fill Method")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _fill_method_value? _fill_method { get; set; }

        public enum _fill_method_value
        {
            /// <summary>
            /// <para>Minimum</para>
            /// <para>Minimum—Null values will be replaced with the minimum (smallest) value of the feature's neighbors.</para>
            /// <para>最小值 - 空值将替换为要素相邻节点的最小（最小）值。</para>
            /// </summary>
            [Description("Minimum")]
            [GPEnumValue("MINIMUM")]
            _MINIMUM,

            /// <summary>
            /// <para>Average</para>
            /// <para>Average—Null values will be replaced with the mean (average) value of the feature's neighbors.</para>
            /// <para>平均值—空值将替换为要素相邻要素的平均值（平均值）。</para>
            /// </summary>
            [Description("Average")]
            [GPEnumValue("AVERAGE")]
            _AVERAGE,

            /// <summary>
            /// <para>Median</para>
            /// <para>Median—Null values will be replaced with the median (sorted middle value) of the feature's neighbors.</para>
            /// <para>中位数—空值将替换为要素相邻点的中位数（排序的中间值）。</para>
            /// </summary>
            [Description("Median")]
            [GPEnumValue("MEDIAN")]
            _MEDIAN,

            /// <summary>
            /// <para>Maximum</para>
            /// <para>Maximum—Null values will be replaced with the maximum (largest) value of the feature's neighbors.</para>
            /// <para>最大值 - 空值将替换为要素相邻要素的最大（最大）值。</para>
            /// </summary>
            [Description("Maximum")]
            [GPEnumValue("MAXIMUM")]
            _MAXIMUM,

            /// <summary>
            /// <para>Temporal Trend</para>
            /// <para>Temporal Trend—Null values will be replaced based on the trend at that unique location.</para>
            /// <para>时态趋势—将根据该唯一位置的趋势替换空值。</para>
            /// </summary>
            [Description("Temporal Trend")]
            [GPEnumValue("TEMPORAL_TREND")]
            _TEMPORAL_TREND,

        }

        /// <summary>
        /// <para>Conceptualization of Spatial Relationships</para>
        /// <para><xdoc>
        ///   <para>Specifies how spatial relationships among features will be defined.</para>
        ///   <bulletList>
        ///     <bullet_item>Fixed distance—Neighboring features within a specified critical distance (the Distance Band parameter value) of each feature will be included in the calculations; everything outside the critical distance will be excluded.</bullet_item><para/>
        ///     <bullet_item>K nearest neighbors— The closest k features will be included in the calculations; k is a specified numeric parameter.</bullet_item><para/>
        ///     <bullet_item>Contiguity edges only— Only neighboring polygon features that share a boundary or overlap will influence computations for the target polygon feature.</bullet_item><para/>
        ///     <bullet_item>Contiguity edges corners— Polygon features that share a boundary, share a node, or overlap will influence computations for the target polygon feature.</bullet_item><para/>
        ///     <bullet_item>Get spatial weights from file—Spatial relationships will be defined by a specified spatial weights file. The path to the spatial weights file is specified by the Weights Matrix File parameter.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何定义要素之间的空间关系。</para>
        ///   <bulletList>
        ///     <bullet_item>固定距离—计算中将包括每个要素的指定临界距离（距离波段参数值）内的相邻要素;临界距离之外的所有内容都将被排除在外。</bullet_item><para/>
        ///     <bullet_item>K 最近邻—计算中将包括最接近的 k 个要素;k 是指定的数值参数。</bullet_item><para/>
        ///     <bullet_item>仅邻接边 - 只有共享边界或重叠的相邻面要素才会影响目标面要素的计算。</bullet_item><para/>
        ///     <bullet_item>邻接边角 - 共享边界、共享节点或重叠的面要素将影响目标面要素的计算。</bullet_item><para/>
        ///     <bullet_item>从文件中获取空间权重 - 空间关系将由指定的空间权重文件定义。空间权重文件的路径由权重矩阵文件参数指定。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Conceptualization of Spatial Relationships")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _conceptualization_of_spatial_relationships_value? _conceptualization_of_spatial_relationships { get; set; } = null;

        public enum _conceptualization_of_spatial_relationships_value
        {
            /// <summary>
            /// <para>Fixed distance</para>
            /// <para>Fixed distance—Neighboring features within a specified critical distance (the Distance Band parameter value) of each feature will be included in the calculations; everything outside the critical distance will be excluded.</para>
            /// <para>固定距离—计算中将包括每个要素的指定临界距离（距离波段参数值）内的相邻要素;临界距离之外的所有内容都将被排除在外。</para>
            /// </summary>
            [Description("Fixed distance")]
            [GPEnumValue("FIXED_DISTANCE")]
            _FIXED_DISTANCE,

            /// <summary>
            /// <para>K nearest neighbors</para>
            /// <para>K nearest neighbors— The closest k features will be included in the calculations; k is a specified numeric parameter.</para>
            /// <para>K 最近邻—计算中将包括最接近的 k 个要素;k 是指定的数值参数。</para>
            /// </summary>
            [Description("K nearest neighbors")]
            [GPEnumValue("K_NEAREST_NEIGHBORS")]
            _K_NEAREST_NEIGHBORS,

            /// <summary>
            /// <para>Contiguity edges only</para>
            /// <para>Contiguity edges only— Only neighboring polygon features that share a boundary or overlap will influence computations for the target polygon feature.</para>
            /// <para>仅邻接边 - 只有共享边界或重叠的相邻面要素才会影响目标面要素的计算。</para>
            /// </summary>
            [Description("Contiguity edges only")]
            [GPEnumValue("CONTIGUITY_EDGES_ONLY")]
            _CONTIGUITY_EDGES_ONLY,

            /// <summary>
            /// <para>Contiguity edges corners</para>
            /// <para>Contiguity edges corners— Polygon features that share a boundary, share a node, or overlap will influence computations for the target polygon feature.</para>
            /// <para>邻接边角 - 共享边界、共享节点或重叠的面要素将影响目标面要素的计算。</para>
            /// </summary>
            [Description("Contiguity edges corners")]
            [GPEnumValue("CONTIGUITY_EDGES_CORNERS")]
            _CONTIGUITY_EDGES_CORNERS,

            /// <summary>
            /// <para>Get spatial weights from file</para>
            /// <para>Get spatial weights from file—Spatial relationships will be defined by a specified spatial weights file. The path to the spatial weights file is specified by the Weights Matrix File parameter.</para>
            /// <para>从文件中获取空间权重 - 空间关系将由指定的空间权重文件定义。空间权重文件的路径由权重矩阵文件参数指定。</para>
            /// </summary>
            [Description("Get spatial weights from file")]
            [GPEnumValue("GET_SPATIAL_WEIGHTS_FROM_FILE")]
            _GET_SPATIAL_WEIGHTS_FROM_FILE,

        }

        /// <summary>
        /// <para>Distance Band</para>
        /// <para>The cutoff distance for the Conceptualization of Spatial Relationships parameter's Fixed distance option. Features outside the specified cutoff for a target feature will be ignored in calculations for that feature. This parameter is not available for the Contiguity edges only or Contiguity edges corners options.</para>
        /// <para>空间关系概念化参数的固定距离选项的截止距离。在目标要素的计算中，超出目标要素指定截止值的要素将被忽略。此参数不适用于“仅邻接边”或“邻接边角”选项。</para>
        /// <para>单位： Feet | Meters | Kilometers | Miles </para>
        /// </summary>
        [DisplayName("Distance Band")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _distance_band { get; set; } = null;


        /// <summary>
        /// <para>Temporal Neighborhood</para>
        /// <para>An interval forward and backward in time that determines which features will be used in calculations for the target feature. Features that are not within this interval of the target feature will be ignored in calculations for that feature.</para>
        /// <para>时间向前和向后的时间间隔，用于确定在目标要素的计算中使用哪些要素。不在目标要素的此区间内的要素将在该要素的计算中被忽略。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Temporal Neighborhood")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _temporal_neighborhood { get; set; } = null;


        /// <summary>
        /// <para>Time Field</para>
        /// <para><xdoc>
        ///   <para>The field containing the time stamp for each record in the dataset. This field must be of type Date.</para>
        ///   <para>This parameter is required if the Location ID parameter value is provided.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含数据集中每条记录的时间戳的字段。此字段的类型必须为“日期”。</para>
        ///   <para>如果提供了位置 ID 参数值，则此参数是必需的。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _time_field { get; set; } = null;


        /// <summary>
        /// <para>Number of Spatial Neighbors</para>
        /// <para><xdoc>
        ///   <para>The number of nearest neighbors that will be included in calculations.</para>
        ///   <para>If the Conceptualization of Spatial Relationships parameter's Fixed distance, Contiguity edges only, or Contiguity edges corners option is chosen, this number is the minimum number of neighbors to include in calculations.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将包含在计算中的最近邻数。</para>
        ///   <para>如果选择了空间关系概念化参数的固定距离、仅邻接边或邻接边角选项，则此数字是计算中要包含的最小邻域数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Spatial Neighbors")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _number_of_spatial_neighbors { get; set; } = null;


        /// <summary>
        /// <para>Location ID</para>
        /// <para><xdoc>
        ///   <para>An integer field containing a unique ID number for each location.</para>
        ///   <para>This parameter is used to match features from the Input Features parameter to rows in the Related Table parameter or to specify a unique location ID for determining temporal neighbors.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含每个位置的唯一 ID 号的整数字段。</para>
        ///   <para>此参数用于将输入要素参数中的要素与相关表参数中的行进行匹配，或指定用于确定时态邻域的唯一位置 ID。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Location ID")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _location_id { get; set; } = null;


        /// <summary>
        /// <para>Related Table</para>
        /// <para>The table or table view containing the temporal data for each feature of the Input Features parameter.</para>
        /// <para>包含输入要素参数的每个要素的时态数据的表或表视图。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Related Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _related_table { get; set; } = null;


        /// <summary>
        /// <para>Related Location ID</para>
        /// <para>An integer field in the Related Table parameter that contains the Location ID parameter value on which the relate will be based.</para>
        /// <para>“相关表”参数中的整数字段，其中包含关联将基于的位置 ID 参数值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Related Location ID")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _related_location_id { get; set; } = null;


        /// <summary>
        /// <para>Spatial Weights Matrix File</para>
        /// <para>The path to a file containing weights that define spatial, and potentially temporal, relationships among features.</para>
        /// <para>包含权重的文件的路径，这些权重用于定义要素之间的空间关系和潜在的时间关系。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Spatial Weights Matrix File")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _weights_matrix_file { get; set; } = null;


        /// <summary>
        /// <para>Unique ID</para>
        /// <para><xdoc>
        ///   <para>An integer field containing a different value for every record in the Input Features parameter. This field can be used to join the results back to the original dataset.</para>
        ///   <para>If you don't have a Unique ID field, you can create one by adding an integer field to the input feature's attribute table and calculating the field values equal to the FID or OBJECTID field.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>一个整数字段，其中包含输入要素参数中每条记录的不同值。此字段可用于将结果连接回原始数据集。</para>
        ///   <para>如果没有唯一 ID 字段，则可以通过向输入要素的属性表添加整数字段并计算字段值等于 FID 或 OBJECTID 字段来创建一个字段。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Unique ID")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _unique_id { get; set; } = null;


        /// <summary>
        /// <para>Null Value</para>
        /// <para>The value that represents null (missing) values. If no value is specified, <Null> is assumed for geodatabase feature classes. For shapefile input, a numeric value of the null placeholder is required.</para>
        /// <para>表示 null（缺失）值的值。如果未指定值， <Null> 则假定为地理数据库要素类。对于 shapefile 输入，需要 null 占位符的数值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Null Value")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _null_value { get; set; } = null;


        /// <summary>
        /// <para>Output Table</para>
        /// <para><xdoc>
        ///   <para>The output table containing the filled (estimated) values.</para>
        ///   <para>The output table is required if a related table is provided.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含填充（估计）值的输出表。</para>
        ///   <para>如果提供了相关表，则输出表是必需的。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_table { get; set; } = null;


        /// <summary>
        /// <para>Append Fields to Input Features</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the filled value fields will be appended to the input features or an output feature class will be created with the filled value fields. If you append the fields, you cannot provide a related table and the output coordinate system environment will be ignored.
        ///   <bulletList>
        ///     <bullet_item>Checked—The fields containing the filled values will be appended to the input features. This option modifies the input data.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—An output feature class will be created containing the filled value fields. This is the default.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定是将填充值字段追加到输入要素，还是使用填充值字段创建输出要素类。如果追加字段，则无法提供相关表，并且输出坐标系环境将被忽略。
        ///   <bulletList>
        ///     <bullet_item>选中 - 包含填充值的字段将追加到输入要素中。此选项修改输入数据。 </bullet_item><para/>
        ///     <bullet_item>未选中—将创建包含填充值字段的输出要素类。这是默认设置。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Append Fields to Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _append_to_input_value _append_to_input { get; set; } = _append_to_input_value._false;

        public enum _append_to_input_value
        {
            /// <summary>
            /// <para>APPEND_TO_INPUT</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("APPEND_TO_INPUT")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NEW_FEATURES</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NEW_FEATURES")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Updated Input Features</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _updated_features { get; set; }


        public FillMissingValues SetEnv(object geographicTransformations = null, object outputCoordinateSystem = null)
        {
            base.SetEnv(geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem);
            return this;
        }

    }

}